<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8"/>
	<meta name="baidu-site-verification" content="JdMif0g2tL" />
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
	<title>angular</title>
	<script src="js/angular.min.js" charset="utf-8"></script>
</head>
<style type="text/css" media="screen">
	*{margin:0;padding: 0;font-size: 16px;}
</style>
<body ng-app="myApp">

<div ng-controller="appCtrl">
	<div>
		{{data | date:'yyyy-M-d HH:mm:ss'}}
	</div>
</div>	

<script type="text/javascript">
	var app =angular.module('myApp', []);
	app.controller('appCtrl', ['$scope', function($scope){
		//创建一个时间
		//y表示年
		//M表示月
		//d表示日
		//E表示星期
		//h表示小时
		//m表示分钟
		//s表示秒
		$scope.data=new Date();
	}])
	var date=new Date();
	var tpl='日期：yyyy, M-d';
	var result=tpl.replace(/(y{1,4})[^yMd]*(M{1,2})[^yMd]*(d{1,2})/g,function(match,$1,$2,$3){
		var m=date.getMonth()+1;
		var d=date.getDate();
		// console.log(match,$1,$2,$3)
		 return match.replace($1,date.getFullYear().toString().slice(4-$1.length))
		 .replace($2,$2.length===1?m:(
		 		m.toString().length===1?'0'+m:m
		 	))
		 .replace($3,$3.length===1?d:(
		 		d.toString().length===1?'0'+d:d
		 	))
	})
	console.log(result)
</script>
<script type="text/javascript">
	document.getElementsByTagName('html')[0].style.fontSize=window.screen.width/10+'px';
</script>
</body>
</html>
<!--应该 6.6-->